301

In the following we want to show five short examples in R. The scripts are kept very

simple and introductory, so that you can solve the problem quickly. However, the problem

and the scripts are usually much more difficult and extensive.

We can now use a t-test to determine whether the mean ozone content in Gardens A and

B is significantly different.

To answer this question, we need to formulate a test hypothesis. The corresponding null

hypothesis (H0) would be: The ozone level is not significantly different, and the corre­

sponding alternative hypothesis (H1) would be: The ozone level is significantly different.

We can reject the null hypothesis at a significance level of 5% (p-value < 0.05). We can

calculate the test statistic in R. To do this, we would read in the data as follows:

> GardenA = c(3, 4, 4, 3, 2, 3, 1, 3, 5, 2)

> GardenB = c(5, 5, 6, 7, 4, 4, 3, 5, 6, 5)

> gardenC = c(3, 3, 2, 1, 10, 4, 3, 11, 3, 10)

For the t-test, we can use the R command t.test:

> t.test(gardenA, gardenB, var.equal=T)

Example 19.1

19.1

Table 19.1  Ozone content in gardens (per 100 million particles, pphm)

Garden A

Garden B

Garden C

3

5

3

4

5

3

4

6

2

3

7

1

2

4

10

3

4

4

1

3

3

3

5

11

5

6

3

2

5

10

19.6  Introduction to Programming (Meta Tutorial)